System system;
Particle_group particle_group;
Star_field star_field;

PImage foreground;
//Space_ship space_ship;

void setup() {
  size(800,200);
  background(0);

  particle_group = new Particle_group(100);
  system = new System(particle_group);

/* @pjs preload="
  data/img.png,
  data/star.png
  "; 
  */  

  star_field = new Star_field();

  float r = random(40,50);
  float g = random(40,50);
  float b = random(40,50);

  star_field.add_field(200, .06, 1.6, color(r,g,b));
  star_field.add_field(200, .03, 1.4, color(r+10,g+10,b+10));
  star_field.add_field(200, .01, 1.2, color(r+20,g+20,b+20));

  foreground = loadImage("data/img.png");

//  space_ship = new Space_ship();

  smooth();
  noStroke();

  rectMode(CENTER);
  shapeMode(CENTER);
  imageMode(CENTER);

  frameRate(60);
}

void draw() {

  fill(0,0,0,100);
  rect(0+width/2,0+height/2,width,height);

  system.math();
  particle_group.math();
  star_field.math();
//  space_ship.math();

  particle_group.render();
  star_field.render();
  
  image(foreground,width/2,height/2);
//  space_ship.render();

}

